<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/hlht/stationHlhtTenantOpen.js"></script>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>互联互通</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>站点开放管理</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });
    var has_add = '';
    var has_edit = '';
    var has_delete = '';
</script>
<style>
    .layui-form-checkbox i{
        border-left: 1px solid #d2d2d2 !important;
    }
    .layui-form-checkbox i {
        width: 20px !important;
        height: 18px !important;
        top: 5px !important;
    }
    .layui-icon-ok:before{
        position: absolute;
        left: 0;
        top: -5px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <div class="row">
                    <input id="tenantOpenId" name="tenantOpenId" type="hidden" value="${hlhtTenantOpen.tenantOpenId}">
                    <input id="tenantCode" name="tenantCode" type="hidden" value="${hlhtTenantOpen.tenantCode}">
                    <input id="hlhtTenantCode" name="hlhtTenantCode" type="hidden"
                           value="${hlhtTenantOpen.hlhtTenantCode}">
                    <input id="hlhtOperatorId" name="hlhtOperatorId" type="hidden"
                           value="${hlhtTenantOpen.hlhtOperatorId}">
                    <input id="hlhtOpenType" name="hlhtOpenType" type="hidden" value="${hlhtTenantOpen.hlhtOpenType}">
                    <input id="hlhtType" name="hlhtType" type="hidden" value="${hlhtTenantOpen.hlhtType}">
                    <input id="hlhtOpenforType" name="hlhtOpenforType" type="hidden">

                    <div class="pull-left search col-md-2 nsbox">
                        <input id="stationName" name="stationName" type="text" class="form-control shortInput input-distance"
                               placeholder="站点名称">
                    </div>

                    <div class="pull-left search col-md-1 nsbox" style="margin-left: -60px;">
                        <select name="tenantCode" id="hlhtOperatoList" class="form-control shortInput input-distance fake_news">
                            <option value="">第三方运营商</option>
                            <c:forEach items="${hlhtOperatoList}" var="hlhtOperatoList">
                                <option value="${hlhtOperatoList.code}">${hlhtOperatoList.name}</option>
                            </c:forEach>
                        </select>
                    </div>
                    <div class="pull-left search col-md-1 nsbox" style="margin-left: 80px">
                        <select name="tenantCode" id="hlhtTenantList" class="form-control shortInput input-distance fake_news">
                            <option value="">SAAS运营商</option>
                            <c:forEach items="${hlhtTenantList}" var="hlhtTenantList">
                                <option value="${hlhtTenantList.code}">${hlhtTenantList.name}</option>
                            </c:forEach>
                        </select>
                    </div>

                    <div class="pull-left search col-md-2" style="margin-left: 80px;">
                        <select class="form-control" id="isOpen" name="isOpen">
                            <option value="" selected>是否开放</option>
                            <option value="0" >否</option>
                            <option value="1" >是</option>
                        </select>
                    </div>
                    <%--<div class="pull-left search col-md-2">
                        <select class="form-control" id="hlhtOpenforType" name="hlhtOpenforType">
                            <option value="">是否支持向第三方开放</option>
                            <option value="0">是</option>
                            <option value="1">否</option>
                        </select>
                    </div>--%>
                    <div class="pull-left search col-md-1" style="flex: 0;">
                        <button class="btn btn-success" onclick="stationHlhtTenantOpen.reLoad()">查询</button>
                    </div>
                    <div class="pull-left search col-md-1" style="flex: 0;">
                        <button type="button" class="btn btn-primary" name="${hlhtTenantOpen.hlhtTenantCode}"
<%--                                hlhtTenantOpen.tenantCode   hlhtTenantOpen.hlhtTenantCode不是空 内部，否则外部--%>
                                onclick="stationHlhtTenantOpen.batchHandleRows(this.name)">
                            开放设置
                        </button>
                    </div>
                    <form class='layui-form' id="open-main" style="display: none">
                    <div class='form-horizontal layui-form' style='width:100%;padding:10px;text-align: left'>
                        <div style='border-bottom: 0.5px solid #ccc;padding-bottom: 20px'>
                            <h1 style='font-size: 16px;color: #000'>是否向对方开放</h1>
                            <div style='font-size: 12px;margin: 5px 0'>（tips :选择'是'，则将站点开放给对方进行运营。反之，不开放）</div>
                            <input type='radio' class='form-control' lay-filter='openStatus' name='openStatus' title='是' checked value='0'>
                            <input type='radio' class='form-control' lay-filter='openStatus' name='openStatus' title='否' value='1'>
                            </div>
<%--                        <div style='padding-top: 20px'><h1 style='font-size: 16px;color: #000'>是否支持对方向第三方开放</h1>--%>
<%--                            <div style='font-size: 12px;margin: 5px 0'>（tips:选择'是'，则将站点开放给对方进行运营。反之，不开放）</div>--%>
<%--                            <input type='radio' name='hlhtOpenforType' checked value='0' title='是'>--%>
<%--                            <input type='radio' name='hlhtOpenforType' value='1' title='否'>--%>
<%--                            </div>--%>
                        </div>
                    </form>
                    <form class='layui-form' id="open-main-ex" style="display: none;">
                        <div class='form-horizontal layui-form' style='width:100%;padding:10px;text-align: left'>
                            <div id="pushline" style='padding-bottom: 20px'>
                                <h1 style='font-size: 16px;color: #000;display: inline-block;vertical-align: middle;margin-top: 6px;margin-right: 140px;'>是否向对方开放</h1>
<%--                                <div style='font-size: 12px;margin: 5px 0'>（tips :选择'是'，则将站点开放给对方进行运营。反之，不开放）</div>--%>
                                <input type='radio' class='form-control' lay-filter='openStatusex' name='openStatusex' title='是' checked value='0'>
                                <input type='radio' class='form-control' lay-filter='openStatusex' name='openStatusex' title='否' value='1'>
                            </div>
                            <div id="fast"><h1 style='font-size: 16px;color: #000;display: inline-block;vertical-align: middle;margin-top: 6px;margin-right: 60px;'>是否支持对方向第三方开放</h1>
<%--                                <div style='font-size: 12px;margin: 5px 0'>（tips:选择'是'，则将站点开放给对方进行运营。反之，不开放）</div>--%>
                                <input type='radio' name='hlhtOpenforType' value='0' title='是' id="raws">
                                <input type='radio' name='hlhtOpenforType' checked value='1' title='否' id="swar">
                            </div>
                            <div id="fast1" style="color: red;">（*选择否将会删除所有开放给外部的第三方运营商）</div>
                            <div style="font-size:16px;color: #000;margin-top: 30px;display: none;" id="swav">勾选第三方运营商（对方只能向您勾选的运营商进行二次开放）</div>
<%--                            <div></div>--%>
<%--                                <select id="innerlist" multiple="true">--%>
<%--                                    <c:forEach items="${hlhtOperatoList}" var="hlhtOperatoList">--%>
<%--                                        <option value="${hlhtOperatoList.code}">${hlhtOperatoList.name}</option>--%>
<%--                                    </c:forEach>--%>
<%--                                </select>--%>
                                <dl id="swaw" class="checkBox" style="padding: 10px 5px;display: none;">
                                    <dt style="padding-bottom: 10px;">
                                        <input type="checkbox"lay-filter="withdrawType" name="withdrawType" id="checkAll">
                                        <label style="font-weight: 700;">全选</label>
                                    </dt>
                                    <div style="border: 1px solid black;">
                                    <dd>
                                        <c:forEach items="${hlhtOperatoList}" var="hlhtOperatoList">
<%--                                            <option value="${hlhtOperatoList.code}">${hlhtOperatoList.name}</option>--%>
                                            <p class="milk" style=" margin-top: 10px;"><input type="checkbox" name="magic" lay-filter="magic" value="${hlhtOperatoList.code}"><label style="padding:0 10px 0 5px;vertical-align: middle;">${hlhtOperatoList.name}</label></p>
                                        </c:forEach>

                                    </dd>
                                    </div>
                                </dl>
                            </div>


                    </form>
                    <div class="pull-left search col-md-2">
                        <button class="btn btn-success exportBtn" style="flex: 0;" onclick="stationHlhtTenantOpen.exportHlhtTenantOpenStation()">导出</button>
                    </div>
                    <%--<div class="pull-left search col-md-1">
                        <button type="button" class="btn btn-primary"
                                onclick="stationHlhtTenantOpen.updateHlhtTenantOpenPriceForBatchOpenStation()">
                            推送价格调整
                        </button>
                    </div>--%>
                    <table id="exampleTable" data-mobile-responsive="true">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    stationHlhtTenantOpen.init();
</script>
</body>
</html>
<script>
    layui.use(['form', 'jquery', 'tree', 'laydate', 'util'], function () {
        // var form = layui.form;
        // var $ = layui.jquery;
    });
// function showOff() {
//   alert('1');
// }

</script>
<script type="text/javascript">



    layui.use(['form', 'jquery', 'tree', 'laydate', 'util'], function () {

        var form = layui.form;
        var $ = layui.jquery;

        form.on("checkbox(withdrawType)", function (data) {

            var child = $(".milk input[type='checkbox']");
            child.each(function (index, item) {
                item.checked = data.elem.checked;

            });
            // if($("input[name='openStatusex']:checked").val() == '1'){
            //     alert('1');
            //     $('#swav').css('dispaly','none');
            //     $('#swaw').css('dispaly','none');
            // }
            // else{
            //     $('#swav').css('dispaly','block');
            //     $('#swaw').css('dispaly','block');
            // }

            form.render('checkbox');
            // console.log($(".milk input[type='checkbox']").checked.val());
        });

        form.on("checkbox(magic)", function (data) {

            var arr_box = [];

            $(".milk input[type='checkbox']:checked").each(function() {
                arr_box.push($(this).val());

            });    //数组

            console.log(arr_box);
            form.render('checkbox');
            // console.log($(".milk input[type='checkbox']").checked.val());
        });
        form.on('radio(openStatusex)', function (data) {
            console.log( data );　　//打印当前选择的信息
            if( data.value == '1'){　
                // alert('1')　　　　　//判断当前多选框是选中还是取消选中
                $('#swav').css('display','none');
                $('#swaw').css('display','none');
                $('#fast').css('display','none');
                $('#fast1').css('display','none');
            }else{
                // $('#swav').css('display','');
                // $('#swaw').css('display','');
                $('#fast').css('display','');
                $('#fast1').css('display','');
            }
            // var value = data.value;   //  当前选中的value值
        });

    });



                    </script>
